#ifndef MAPTCPSOCKET_H
#define MAPTCPSOCKET_H

#include <QObject>
#include <QTcpSocket>
#include "common.h"

class mapTcpSocket : public QObject
{
    Q_OBJECT
public:
    explicit mapTcpSocket(QObject *parent = nullptr);
    ~mapTcpSocket();
signals:

    void sig_RevData(QString type,QStringList data);


    void sig_mapTopicPgm(QPixmap pixmap);

    void sig_Loger(QString logger);

public:
    QString m_getDataMess;
    bool is_Get = false;
    QTcpSocket* m_socket = NULL;  //底盘通信
    QString m_Ip;
    int m_Port;
    QByteArray m_ByteDataTcp;
public slots:
    bool connectToHost(QString ip,int port);
    void slot_getCreatorMapData(QString Msg);
    void sendData(QString Msg);
    void slotTcpRevData();

    void DataToPgm(QVariantList dataList,int width,int height);
    void displayPGM(int8_t *data, int width, int height, int maxValue);
    void savePGM(const std::string& filename, int8_t* data, int width, int height, int max_value);

};

#endif // MAPTCPSOCKET_H
